#include "getfiledialog.h"
#include "ui_getfiledialog.h"
#include "cfiletransfer.h"
#include <QDebug>
#include <QDir>

getfiledialog::getfiledialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::getfiledialog)
{
    ui->setupUi(this);
    ui->saveAddrEdit->setText(QDir::currentPath());
}

getfiledialog::~getfiledialog()
{
    delete ui;
}

void getfiledialog::setConn(CLoginCfgMgr::TConnectItem& item)
{
    m_connItem = item;
    //qDebug() << m_connItem.m_ip;
    ui->getfileaddrEdit->setText(m_connItem.m_user+"@"+m_connItem.m_ip);
}

void getfiledialog::on_getfileButton_clicked()
{
    CFileTransfer::getFile(m_connItem
                           ,ui->getfileEdit->text()
                           ,ui->saveAddrEdit->text());
}
